/**
 * 
 */
package com.jonosoft.photocast.viewer.web.client.util;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * TODO Add description Size (com.jonosoft.photocast.viewer.web.client.util.Size)
 *
 * @author jon
 *
 */
public class Size implements IsSerializable, Cloneable {
	
	private static String PX = "px";
	
	private Number w = null;
	private Number h = null;
    
    public Size() {
    	this(0, 0);
    }

	/**
     * @param i
     * @param j
     */
    public Size(Number width, Number height) {
	    this.w = width;
	    this.h = height;
    }
    
    public Size(int width, int height) {
    	this(new Integer(width), new Integer(height));
    }
    
    public Object clone() {
    	return new Size(getWidth(), getHeight());
    }

	public Number getWidth() {
    	return this.w;
    }
    
    public Number getHeight() {
    	return this.h;
    }
    
    public String getCSSWidth() {
    	return w == null ? "auto" : w.toString() + PX;
    }
    
    public String getCSSHeight() {
    	return h == null ? "auto" : h.toString() + PX;
    }
    
    public void setWidth(Number width) {
    	this.w = width;
    }
    
    public void setHeight(Number height) {
    	this.h = height;
    }
    
    public void setWidth(int width) {
    	this.w = new Integer(width);
    }
    
    public void setHeight(int height) {
    	this.h = new Integer(height);
    }

	/**
     * TODO Add method description for setSize
     *
     * @param i
     * @param j
     */
    public void setSize(int width, int height) {
    	setSize(new Integer(width), new Integer(height));
        }

	/**
     * TODO Add method description for setSize
     *
     * @param integer
     * @param integer2
     */
    public void setSize(Number width, Number height) {
	    this.w = width;
	    this.h = height;
    }

}
